<?php require_once('../functions.php');
if((!isset($_SESSION['oPinfo']['LIMITEDMODE']) || $_SESSION['oPinfo']['LIMITEDMODE'] != true)) {
/*****[BEGIN]******************************************
 [ Base:     oPanel updater                   v1.0.1 ]
 ******************************************************/ 
//echo '<fieldset style="background:url(images/oPanelUpdate.png);background-repeat:no-repeat;background-position:left;height:113px;"><legend>oPanel Updater</legend>';
$update = API_Connect("TYPE=".urlencode('updateCheck'));
$i = 0; $table ='';
while($i < count($update)) {
$temp = deformatNVP($update[$i]);
if(md5(ROOT_PATH.$temp['NAME']) != $temp['md5']) {
if($i == 0) {$class = ' class="u2"';} else {$class='';} $file = ROOT_PATH.$temp['NAME'];
if(is_writable(ROOT_PATH.$temp['NAME'])) { $writable = '<span style="color:green">File is writable</span>'; } else { $writable = '<span style="color:#FF0000">File is not writable!</span>'; }
$table .=<<<AOE
      <tr>
        <td{$class}><input type="checkbox" name="file" value="{$temp['NAME']}" /></td>
        <td{$class}><div align="center">{$file}</div></td>
        <td{$class}><div align="center">{$writable}</div></td>
      </tr>
AOE;
}
$i++;
}
//if(md5(ROOT_PATH.$update['[0]NAME']) != $update['[0]md5']) {
//echo 'the file <i>'.basename($update['[0]NAME']).'</i> requires an update';
//}
//echo urldecode($update['code']);

/*****[END]********************************************
 [ Base:     oPanel updater                   v1.0.1]
 ******************************************************/
//--------------------------------------------------------------------------
} else { $error = 'oPanel cannot be updated in limited functionality mode'; }
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
<style type="text/css">
.u2 {
	border-top-style: solid;
	border-top-width: 1px;
}
</style>

</head>

<body><form name="update" action="" method="post">
<table width="100%" border="2" cellspacing="0" cellpadding="0">
  <tr>
    <td valign="top" style="background:url(images/updater/leftb.jpg); background-color:#cccccc; background-position:right; background-repeat:repeat-y"><div align="center"><p>&nbsp;</p>
	<p>Updater settings</p>
    <p>View update history</p></div></td>
    <td align="center" valign="top" style="background:url(images/oPanelUpdate.png); background-repeat:no-repeat; background-position:center; width:80%; height: 300px;"><div id="updater"><table width="90%" border="0" cellspacing="0" cellpadding="0">
      <tr >
        <td width="40" class="style1"><input type="checkbox" name="all" onchange="checkAll()" value="true" /> All</td>
        <td><div align="center">File to be updated</div></td>
        <td><div align="center">Writable</div></td>
      </tr>
 <?=$table;?>
    </table>
	<div style="vertical-align: bottom; text-align:right;"><input class="nButton" name="updater" onclick="javascript:update('update/updater.php','POST');" value="Update Now" type="button">
&nbsp;</div></div></td>
  </tr>
  <tr>
    <td colspan="2" style="background:url(images/updater/footerbg.jpg); background-color:#cccccc; background-repeat: repeat-x; background-position:top;""><div class="credits" align="center">oPanel Updater V1 &copy; <?=date('Y');?><br />
	The oPanel Updater is a part of The oPanel Project &copy; <a href="http://olliespage.net" class="credits" target="_blank">OlliesPage.net</a> - All rights reserved. </div></td>
  </tr>
</table>
</form>
</body>
</html>